int and float increment condition in for loop [on hold]

Posted by Mazaya Jamil on Stack Overflow See other posts from Stack Overflow or by Mazaya Jamil
Published on 2014-06-09T05:56:00Z Indexed on 2014/06/10 3:26 UTC
Read the original article Hit count: 164

Filed under:
|
|
|

I am doing a program that involves integer and float number.Let say I want to calculate atx={1,1/2,2,3,4} and want to use for-loop. But I know the condition of increment

for(x=1;x<=4;x++)

as x++=x+1.

I want to find the iteration at x={1,2,3,4} and at x={1/2}. But I do not have idea how to modify the for-loop statement; either to make the increment of 0.5 or 1. But if I set 0.5, I will get the answers for 5/2 and 7/2 instead.

© Stack Overflow or respective owner

Related posts about c++

Related posts about for-loop